//
//  Product_ horizontalCell.m
//  pmmSS
//
//  Created by Mac book on 2017/9/13.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "Product_ horizontalCell.h"

@implementation Product__horizontalCell


-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    NSLog(@"%s",__func__);
    if (self = [super initWithCoder:aDecoder]) {
        [self initViews];
    }
    return self;
}

-(void)initViews{

    WeakSelf(weakSelf);

    _icon_imageView  = [[UIImageView alloc]init];
    _icon_imageView.backgroundColor = [UIColor yellowColor];
    [_icon_imageView setImage:[UIImage imageNamed:@"list_icon_shop"]];

    [self.contentView addSubview:_icon_imageView];

    _title_label = [ HMLabel createLabelWithText:@"特价处理/批发 工型钢(H型钢)" andTextColor:[UIColor blackColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(14)] andTextAlignment:NSTextAlignmentLeft];

    _title_label.numberOfLines = 2 ;

    [self.contentView addSubview:_title_label];

    _location_label = [ HMLabel createLabelWithText:@"钢材市场" andTextColor:RGBA(102,102,102,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(14)] andTextAlignment:NSTextAlignmentLeft];

    [self.contentView addSubview:_location_label];

    _icon_price_label  = [ HMLabel createLabelWithText:@"￥" andTextColor:RGBA(252,74,0,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(12)] andTextAlignment:NSTextAlignmentLeft];


    [self.contentView addSubview:_icon_price_label];

    _price_label  = [ HMLabel createLabelWithText:@"6688" andTextColor:RGBA(252,74,0,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft];

    [self.contentView addSubview:_price_label];

    _yishou_label  = [ HMLabel createLabelWithText:@"已售  68596" andTextColor:RGBA(171,171,171,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(12)] andTextAlignment:NSTextAlignmentRight];

    [self.contentView addSubview:_yishou_label];

    //-----------************---------

    [_icon_imageView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerY.mas_equalTo(weakSelf.contentView);
        make.left.mas_equalTo(autoScaleH(12.5));
        make.width.mas_equalTo(autoScaleW(96));
        make.height.mas_equalTo(autoScaleH(96));

    }];

    [_title_label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.contentView).offset(autoScaleW(134));
        make.top.mas_equalTo(weakSelf.contentView).offset(autoScaleH(13));
        make.width.mas_equalTo(autoScaleW(230));
        make.height.mas_equalTo(autoScaleH(20));

    }];
    [_location_label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.contentView).offset(autoScaleW(140));
        make.bottom.mas_equalTo(weakSelf.contentView).offset(autoScaleH(-13));
        make.width.mas_equalTo(autoScaleW(82));
        make.height.mas_equalTo(autoScaleH(20));

    }];

    [_icon_price_label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.contentView).offset(autoScaleW(141));
        make.centerY.mas_equalTo(weakSelf.contentView);
        make.width.mas_equalTo(autoScaleW(10));
        make.height.mas_equalTo(autoScaleH(17));

    }];
    [_price_label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.contentView).offset(autoScaleW(153.5));
        make.centerY.mas_equalTo(weakSelf.contentView);
        make.width.mas_equalTo(autoScaleW(70));
        make.height.mas_equalTo(autoScaleH(25));

    }];

    [_yishou_label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.contentView).offset(autoScaleW(247));
        make.bottom.mas_equalTo(weakSelf.contentView).offset(autoScaleH(-13.6));
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(14));
        
    }];

    
}


-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initViews];
    }
    return self;
}@end
